home *** CD-ROM | disk | FTP | other *** search
/ Amiga Inside! / Amiga FD Inside (1995)(Ultramax).iso / berndspd / devtools / intuigen / doc / igrequest.txt < prev    next >
Encoding:
Text File  |  1995-04-21  |  53.7 KB  |  1,597 lines

  1. IGRequest.txt doc
  2.  
  3. (C) Copyright 1993 Justin Miller
  4.       This file may be freely distributed with IntuiGen 2.0.
  5.       All Other Rights Reserved.
  6.       The Author makes no warranties, express or implied, as to
  7.     the accuracy or suitability of the material contained herein.
  8.  
  9. What is IGRequest
  10. IGRequest refers to the set of functions found in the IGRequest.c file
  11. which manages an IntuiGen generated requester under Intuition (not
  12. GadTools).  This file documents these functions, their use, and the
  13. structures that drive them.
  14.  
  15.  
  16.  
  17. Displaying an IGRequest
  18. To display an IGRequest, simply use IntuiGen to generate an IGRequest
  19. structure and the associated Gadget, NewWindow, and IGInfo structures,
  20. and then call IGRequest as follows:
  21.  
  22.     main()
  23.     {
  24.     struct IGEndList *el;
  25.     ...
  26.  
  27.     el=IGRequest(&MyRequest);
  28.  
  29.     /*
  30.         if el==0, IGRequest failed due to inadequate resources, or
  31.         other error otherwise IGEndList points to the EndList item that
  32.         describes the conditions under which IGRequest ended.  See the
  33.         IGEndList structure.
  34.     */
  35.  
  36.     FreeRemember(&MyRequest.ReqKey,1);
  37.     }
  38.  
  39.  
  40. Note that the FreeRemember is necessary under IGRequest, as it leaves
  41. string buffers, etc. allocated so you can access them after the routine
  42. has returned.  This is in contrast to GTRequest.
  43.  
  44.  
  45.  
  46. Ending an IGRequest
  47. A IGRequest will automatically be ended when the user clicks on a gadget
  48. that was defined as an IGEndGadget from within IntuiGen.  If you wish to
  49. programatically end an IGRequest from a callback function, simply set the
  50. request's terminate field to a non-zero value.  if the value is greater
  51. than zero, the associated data structure is filled with the values from the
  52. linked Gadgets in the requester (usually an OK-type response).  If the
  53. value is less than zero, the structure is not filled.
  54.  
  55.  
  56.  
  57. Prop Gadgets
  58. IntuiGen generated Prop Gadgets for IGRequest include the main Prop Gadget
  59. and two arrows.  IGRequest code automatically handles messages from the
  60. arrows, moving the Prop Gadget the appropriate direction, and calling the
  61. Prop Gadget's ScrollFunc.  Note that the values passed to your ScrollFunc
  62. are scaled according to the DisplayedX, DisplayedY, MaxX, and MaxY values
  63. you set through ModifyIGProp or initially set in the PropInfo structure.
  64. See the {"PropInfo" LINK PropInfoStructure} structure for more information.
  65.  
  66. ModifyIGProp is a function found in the IGRequest library.  This function
  67. MUST be used when dealing with a prop Gadget in an IGRequest instead of
  68. Intuition's ModifyProp function.  This function is easier to use, as you
  69. give it your numbers, not Intuition's numbers, in setting the Prop Gadget's
  70. size and position.
  71.  
  72.  
  73.  
  74. Creating a ListBox
  75. Under IGRequest, List boxes are called Select Boxes.  IntuiGen does not
  76. generate code for select boxes, but you can manually enter it.    To create a
  77. SelectBox under IGRequest:
  78.  
  79. 1) Create an IGRequest structure with IntuiGen.  The IGRequest should have
  80.     a vertical Scroll bar in it.  The scroll bars height should be
  81.     the number of entries you want displayed in your SelectBox * 10 + 6.
  82.  
  83.  
  84. 2) Enter the follow structure before the Proportional Gadget's IGInfo
  85.     structure in you code:
  86.  
  87.     struct SelectBox MySelectBox {
  88.     NULL,      /* Next SBox */
  89.     myLeftEdge, myTopEdge,
  90.     myWidth, myNumberOfLines,
  91.         /* Number entries displayed at one time
  92.            used to calculate height=10*Displayed+6 */
  93.  
  94.     0, /* NumberEntries - Total number of entries in list,
  95.                     may be changed while selectbox running */
  96.  
  97.     SB_RELVERIFY,
  98.         /* SelectBox Flags - may be one of:
  99.          SB_TOGGLEALL  All entries are TOGGLESELECT, may have any
  100.                 combination turned on or off
  101.          SB_TOGGLEONE  All entries are TOGGLESELECT, only one may
  102.                 be selected at a time, others are turned off
  103.          SB_RELVERIFY  each entry is a simple RELVERIFY Gadget, no
  104.                 toggling supported */
  105.  
  106.  
  107.     2,    /*  BColor1     Color of Left and Top Borders */
  108.     1,    /*  BColor2     Color of Right and Bottom Borders */
  109.  
  110.     NULL,  /* SBoxBorder */
  111.         /*    Pointer to Border structure to use.  Can be initialized,
  112.         but if not, border is automatically allocated using BColor1, BColor2 */
  113.  
  114.     NULL, /*  Pointer to Prop Gadget associated with this SelectBox.  Can
  115.         be left unitialized  */
  116.  
  117.     NULL, /* Always Leave NULL */
  118.  
  119.     NULL, /* Entries - Can be initialized, or can be indirectly
  120.                 updated through AddEntry, AddEntryAlpha, etc */
  121.  
  122.     NULL, /* leave NULL */
  123.  
  124.     NULL, /* leave NULL */
  125.  
  126.  
  127.     ItemSelectedFunc,
  128.         /*
  129.            Function to call when an item is selected
  130.  
  131.         void (*ItemSelected) (struct IGRequest *,struct SelectBox *,
  132.             struct SelectBoxEntry *,struct IntuiMessage *);
  133.         */
  134.  
  135.     ItemDSelectedFunc,
  136.         /*
  137.            Function to call when an item is deselected
  138.  
  139.         void (*ItemDSelected) (struct IGRequest *,struct SelectBox *,
  140.                 struct SelectBoxEntry *,struct IntuiMessage *);
  141.         */
  142.  
  143.     NULL, /* leave NULL */
  144.     NULL  /* UserData - Can be anything */
  145.     };
  146.  
  147. 3) Change the SBox field of the proportional Gadget's IGInfo structure
  148.     to point to MySelectBox.
  149.  
  150. 4) Change the SBoxes field of your IGRequest structure to point to the
  151.     above structure you just created.
  152.  
  153. 5) Run the IGRequest.  In the InitFunction, call AddEntry, AddEntryAlpha, etc,
  154.     to add your entries to the SelectBox.
  155.  
  156. See {"SelectBox" LINK SelectBoxFunctions} SelectBox Functions for information on controlling SelectBoxes
  157. after the request has been started.
  158.  
  159.  
  160.  
  161. Creating a File Requester
  162. To open an IGFR File requester, you must first manually enter two
  163. structures in addition to your IGRequest structure.  Use the following
  164. templates to help you out:
  165.  
  166. 1) Enter a IGFileRequest structure:
  167.  
  168.     struct IGFileRequest MyFileRequest = {
  169.     mLeftEdge,mTopEdge, /* LeftEdge, TopEdge of FileRequester */
  170.                 /* Width and Height are 310 x 122 automatically */
  171.  
  172.     "sys:",    /* Current directory is taken from this */
  173.                 /* Upon exit, chosen file and path name is
  174.                 /* stored here */
  175.  
  176.     "",        /* File extension, only files with this extension
  177.                 * will be placed in Requester
  178.                 * if empty, all files are listed
  179.            */
  180.  
  181.     2,1,   /* Border Colors for SBox border and FileRequest
  182.                 * Border */
  183.     IGFR_OKCANCEL | IGFR_NOINFO | IGFR_CURRENTDIR,
  184.            /***  Flags:
  185.  
  186.             IGFR_OKCANCEL      Put Ok and Cancel Gadgets
  187.                     in requester
  188.             IGFR_CURRENTDIR   Initialize requester to
  189.                     current directory
  190.             IGFR_NOINFO      Do not display info files
  191.             IGFR_MULTISELECT  Have ToggleSelect FileRequester
  192.                     Selected Entries can be read
  193.                     by cycling through IGDirEntry
  194.                     list pointed to by First.
  195.                     In MultiSelect requesters, this
  196.                     list is not freed upon termination
  197.                     of the request (so that it can be
  198.                     examined later).  To free it,
  199.                     FreeRemember the DirKey.
  200.                     When this option is on, a single
  201.                     click selects a directory, a
  202.                     double click opens it.
  203.             IGFR_VARSSAVED       This causes the Selectbox
  204.                         to be completely cleared
  205.                         and the display rebuilt
  206.                         from DirEntries present
  207.                         upon initialization.
  208.                         This can be used when
  209.                         Manually saving variables,
  210.                         including the DirEntry list,
  211.                         Closing the request, and
  212.                         then reopening it with a
  213.                         a directory already read.
  214.             IGFR_NOFILESELECT  Causes File names to be ghosted,
  215.                         not selectable
  216.  
  217.  
  218.     /* These should all be initialized to zero */
  219.  
  220.     0, /* Init to Zero */
  221.     0, /* Init to Zero */
  222.     0, /* Init to Zero */
  223.     0, /* Init to Zero */
  224.     0, /* Init to Zero */
  225.     0, /* Init to Zero */
  226.     0, /* Init to Zero */
  227.     0, /* Init to Zero */
  228.     0, /* Init to Zero */
  229.     0, /* Init to Zero */
  230.     0, /* Init to Zero */
  231.     0, /* Init to Zero */
  232.     0, /* Init to Zero */
  233.     0, /* Init to Zero */
  234.     0, /* Init to Zero */
  235.  
  236.     /* These can be used by you or other objects */
  237.  
  238.     0,     /* Object field - Pointer to IGObject of which this is part
  239.                     * DOES NOT POINT BACK TO THIS REQUESTER'S
  240.                     * IGOBJECT STRUCTURE.  This permits
  241.                     * a file requester to be part of another
  242.                     * IGObject */
  243.     0 /* UserData */
  244.     };
  245.  
  246. 2) Enter a IGObject structure:
  247.  
  248.     struct IGObject MyFileReqObject = {
  249.     MakeIGFileRequest, /* This is a function prototyped in IGFR.h */
  250.                /* All File request objects must have this
  251.                   function in this first field
  252.                */
  253.  
  254.     NULL,  /* Init to Zero, MakeIGFileRequest will fill in */
  255.     NULL,  /* Init to Zero, MakeIGFileRequest will fill in */
  256.  
  257.     NULL,
  258.  
  259.     NULL,  /* Init to Zero, MakeIGFileRequest will fill in */
  260.     &MyFileRequest,
  261.     0, /* Init to Zero */
  262.     0, /* Init to Zero */
  263.     0,
  264.     NULL, /* struct IGObject *Next; - for linking multiple objects
  265.             for instance,you can have more than one file requester */
  266.     0, /* Prev field - Don't initialize, IGRequest will fix */
  267.     "FileSelector", /* Name for this Object to be addressed by via Rexx Programs */
  268.     0 /* APTR UserData; */
  269.     };
  270.  
  271. 3) Change the IGObjects field of the IGRequest to point to MyFileReqObject.
  272.  
  273. 4) Link your program with IGRequest.c and IGFR.c.
  274.  
  275. Note that the size of an IGFR File requester is pre-determined at
  276. 310 x 122.  You may have some problems with the arrows on the file
  277. requester's scroll bar.  If you define a scroll bar elsewhere, the chipdata
  278. for the arrows will be duplicated between your file and IGFR.c.  In this
  279. case you should comment one out.  You will also have to insure that this
  280. arrow data is moved into chip memory.  Most compilers accept the chip
  281. keyword to do this, however some don't.  For this reason, the chip keyword
  282. is not included in the arrow image definitions in IGFR.c.  If your compiler
  283. supports this keyword you should add it.  Otherwise you will have to copy
  284. the image data from fast ram to chip ram using AllocMem and CopyMem.
  285.  
  286. To determine whether the image definitions for the arrows are included in
  287. IGFR.c or not, there is a define at the beginning of the file,
  288. INCLUDEARROWDATA.  If this define is commented out, the arrow data will not
  289. be included.  If this constant is defined, the arrow data will be included.
  290.  
  291. For information on controlling an IGFR file request as it is running,
  292. consult FileRequest Functions.
  293.  
  294.  
  295.  
  296. Opening Multiple Requests
  297. IGRequest is fully re-entrant, and can therefore be called recursively and
  298. from multiple tasks.  IGRequest does not support the simultaneous operation
  299. of several requests from the same task like GTRequest does.  You either
  300. must block the first any open requests, and call IGRequest to display your
  301. new requester, or you must start another thread and call IGRequest to
  302. display your new requester. The first method would look something like
  303. this:
  304.  
  305. main()
  306. {
  307.     ...
  308.  
  309.     IGRequest(&MyRequest1);
  310.  
  311.     ...
  312.  
  313.     FreeRemember(&MyRequest1.ReqKey,1);
  314.  
  315.     ...
  316. }
  317.  
  318. void SomeGadgetUpFunc(struct IGRequest *req, struct IntuiMessage *msg)
  319. {
  320.     BlockIGInput(req);
  321.  
  322.     IGRequest(&MyRequest2);
  323.  
  324.     ...
  325.  
  326.     FreeRemember(&MyRequest2.ReqKey,1);
  327.  
  328.     ...
  329.  
  330.     UnBlockIGInput(req);
  331. }
  332.  
  333. Using the second method, main would remain the same, and SomeGadgetUpFunc
  334. would read as follows:
  335.  
  336. void SecondRequest(void);
  337.  
  338. void SomeGadgetUpFunc(struct IGRequest *req, struct IntuiMessage *msg)
  339. {
  340.     NewThread(SecondRequest);
  341. }
  342.  
  343. void SecondRequest (void)
  344. {
  345.     ...
  346.  
  347.     IGRequest(&MyRequest2);
  348.  
  349.     ...
  350.  
  351.     FreeRemember(&MyRequest2.ReqKey,1);
  352. }
  353.  
  354.  
  355.  
  356. BitField Macros
  357. These are defined in IntuiGen.h:
  358.  
  359. #define FLAGOFF(x,flag) ((x)&=0xffffffff^(flag))
  360. #define FLAGON(x,flag) ((x)|=(flag))
  361.  
  362. #define ISFLAGON(x,flag) ((x) & (flag))
  363. #define ISFLAGOFF(x,flag) (!(ISFLAGON(x,flag)))
  364.  
  365.  
  366.  
  367. IGFR Flags
  368. These are defined in IntuiGen.h:
  369.  
  370. #define IGFR_VARSSAVED 256
  371. #define IGFR_OKCANCEL 4
  372. #define IGFR_CURRENTDIR 16
  373. #define IGFR_NOINFO    64
  374. #define IGFR_MULTISELECT 128
  375. #define IGFR_INCLUDEASSIGNS 512
  376. #define IGFR_NOFILESELECT 1024
  377.  
  378.  
  379.  
  380. IGRequest Flags
  381. These are defined in IntuiGen.h:
  382.  
  383. #define IG_ADDGADGETS 1
  384. #define IG_INITREQUESTERTOOPEN 2
  385. #define IG_INITDATASTRUCT 4
  386. #define IG_RECORDWINDOWPOS 8
  387.  
  388.  
  389.  
  390. SelectBox Structure
  391. This is defined in IntuiGen.h:
  392.  
  393. struct SelectBox {
  394.     struct SelectBox *Next;
  395.     USHORT LeftEdge;
  396.     USHORT TopEdge;
  397.     USHORT Width;
  398.     USHORT Displayed;           /* Number entries displayed at one time
  399.                   used to calculate height=10*Displayed+6 */
  400.     USHORT NumberEntries;      /* Total number of entries in list,
  401.                   may be changed while selectbox running */
  402.     USHORT Flags;
  403.     /* SB_TOGGLEALL  All entries are TOGGLESELECT, may have any combination
  404.              turned on or off
  405.        SB_TOGGLEONE  All entries are TOGGLESELECT, only one may be selected
  406.              at a time, others are turned off
  407.        SB_RELVERIFY  each entry is a simple RELVERIFY Gadget, no toggling
  408.              supported */
  409.     UBYTE  BColor1,BColor2;
  410.     /*  BColor1    Color of Left and Top Borders
  411.         BColor2    Color of Right and Bottom Borders */
  412.     struct Border *SBoxBorder;
  413.     /*  Pointer to Border structure to use.  Can be initialized,
  414.         but if not, border is automatically allocated using BColor1, BColor2 */
  415.     struct Gadget *Prop;
  416.     /*  Pointer to Prop Gadget associated with this SelectBox.  Can
  417.         be left unitialized  */
  418.     struct Gadget *GList;    /* leave NULL */
  419.     struct SelectBoxEntry *Entries; /* Can be initialized, or can be indirectly
  420.                        updated through AddEntry, AddEntryAlpha, etc */
  421.     struct SelectBoxEntry *Selected; /* leave NULL */
  422.     struct Remember *SBKey; /* key upon which all necessary structures are allocated */
  423.                 /* is freed upon exit from IGRequest */
  424.  
  425.     void (*ItemSelected) (struct IGRequest *,struct SelectBox *,
  426.               struct SelectBoxEntry *,struct IntuiMessage *);
  427.               /* Function to call when an item is selected */
  428.  
  429.     void (*ItemDSelected) (struct IGRequest *,struct SelectBox *,
  430.                struct SelectBoxEntry *,struct IntuiMessage *);
  431.               /* Function to call when an item is deselected */
  432.  
  433.     struct IGObject *IGObject; /* Object which this SelectBox is part of */
  434.     APTR UserData;
  435. };
  436.  
  437.  
  438.  
  439. SelectBoxEntry Structure
  440. This is defined in IntuiGen.h:
  441.  
  442. struct SelectBoxEntry {
  443.     UBYTE *Text; /* Pointer to text string to be used */
  444.     UBYTE Color; /* Color of text printed in Select Box */
  445.     USHORT Flags;
  446.     /* SB_SELECTED        Item is selected, should be highlighted
  447.        SB_NOTSELECTED   Item is not selected, not highlighted */
  448.     USHORT ID; /*  ID, SBox Entries must be numbered sequentially,
  449.            from 0 to X,  Use FixIDs () to accomplish this */
  450.     struct Gadget *Gadget; /* Gadget this entry is currently linked to
  451.                   will change as user scrolls through select box */
  452.  
  453.     void (*ItemSelected) (struct IGRequest *,struct SelectBox *,
  454.               struct SelectBoxEntry *,struct IntuiMessage *);
  455.              /* Function to call when this item is selected,
  456.                 called after Global ItemSelected () from
  457.                 SelectBox structure is called. */
  458.  
  459.     void (*ItemDSelected) (struct IGRequest *,struct SelectBox *,
  460.                struct SelectBoxEntry *,struct IntuiMessage *);
  461.               /* Function call when this item is deselected,
  462.                   Everything same as ItemSelected above */
  463.  
  464.     struct SelectBoxEntry *Next,*Prev; /* Used to link together SBox Entries
  465.                       Only the next link needs to be filled in,
  466.                       IGRequest will call FixLinks () to
  467.                       fill in Prev links */
  468.     struct IGObject *IGObject; /* Object which this SBEntry is part of */
  469.     APTR UserData;
  470. };
  471.  
  472.  
  473.  
  474. IGBoolInfo Structure
  475. This is defined in IntuiGen.h:
  476.  
  477. struct IGBoolInfo {
  478.     USHORT Type; /* must be GADG_BOOL. Can also contain:
  479.             GADG_INITONCE       Initialize the on/off state of
  480.                        Gadget first time requester is
  481.                        opened.  Leave as user leaves it
  482.                        thereafter.
  483.             GADG_INITALWAYS    Initialize the on/off state of
  484.                        Gadget every time the requester is
  485.                        opened.
  486.             GADG_ONESELECTED   If this is part of a series of
  487.                        mutual exclude toggleselect gadgets,
  488.                        one must always be selected.
  489.             BOOL_FILL       Copy Values to and from
  490.                        Datastruct given in IGRequest
  491.                        using the BitToSet in the longword
  492.                        at offset DataStructOffset
  493.                        as the source/destination
  494.                        See below.
  495.          */
  496.     USHORT InitialValue; /* For ToggleSelect Gadgets. Can be set to
  497.                  NULL          Gadget is off
  498.                  GFLG_SELECTED    Gadget is on
  499.              */
  500.     USHORT DataStructOffSet; /* OffSet of integral field to set to true or
  501.                 false on exit from IGRequest (toggleselect
  502.                 gadgets only) */
  503.     UBYTE  BitToSet;         /* Bit in data field to set to true or false */
  504.  
  505.     void (*GUpFunction) (struct IGRequest *,struct IntuiMessage *);
  506.     void (*GDownFunction) (struct IGRequest *,struct IntuiMessage *);
  507.     void (*DClickFunction) (struct IGRequest *,struct IntuiMessage *);
  508.  
  509.     struct IGObject *IGObject; /* Object which this Bool Gadget is part of */
  510.     UBYTE *RexxName; /* Name that Arexx commands can refer to this gadget by */
  511.     APTR UserData;
  512.  
  513. /* FOR MUTUAL EXCLUDE TOGGLESELECT GADGETS:
  514.     Under IGRequest the MutualExclude long word in the Gadget structure has
  515.     been implemented.  Each group of mutual exclude Gadgets should be assigned
  516.     a bit, and this bit set in each Gadget's structure in the MutualExclude
  517.     field.  Gadget's that have the same bit set will not be able to be
  518.     activated simultaneously (turning one on will turn the other off).
  519.     NOTE:  Using the MutualExclude field to contain other information in
  520.         ToggleSelect Gadgets will have undesirable results
  521. */
  522. };
  523.  
  524.  
  525.  
  526. IGStringInfo Structure
  527. This is defined in IntuiGen.h:
  528.  
  529. struct IGStringInfo {
  530.     USHORT Type; /* must be GADG_STRING */
  531.     /* Can also contain
  532.         STRING_FLOAT  This gadget contains a floating point numeral
  533.                   Structure field to be filled is of type IGFloat
  534.                   (typedefed as float)
  535.         STRING_LONG   This gadget contains a long integer,
  536.                   structure field to be filled is of type LONG
  537.         STRING_SHORT  This gadget contains a short integer
  538.                   structure field to be filled is of type SHORT
  539.         STRING_LOWLIMIT
  540.                   StringLow is to be imposed on this string gadget
  541.         STRING_HIGHLIMIT
  542.                   StringHigh is to be imposed on this string gadget
  543.         STRING_FILL   fill structure field at offset in DataStructOffSet
  544.                   when ending of type FILLSTRUCT is chosen
  545.         STRING_INITONCE
  546.                   Setting this flag will cause whatever is in
  547.                   the IGInfo->InitialValue field to be copied
  548.                   into the buffer.    This flag is then cleared.
  549.         STRING_INITALWAYS
  550.                   Setting this flag will cause whatever is in
  551.                   the IGInfo->InitialValue field to be copied
  552.                   into the buffer every time the requester is
  553.                   opened.
  554.  
  555.     NOTE:  If IGRequest allocates a buffer for a string, it will always
  556.            copy IGInfo->InitialValue to the buffer, which would otherwise
  557.            be completely blank.  It will only do this when it actually
  558.            allocates the buffers, which would be the first time through,
  559.            or the first time through after you Free them.
  560.     */
  561.  
  562.     UBYTE *InitialValue;    /* pointer to string to copy into buffer when
  563.                 requester begins */
  564.     UBYTE *DisAllowedChars; /* pointer to string, characters in which are
  565.                    not to be allowed in this string gadget */
  566.     USHORT DataStructOffSet; /* offset from structure of field that contents
  567.                 of this string gadget should be copied to */
  568.  
  569.     /* These set limits on contents of numerical string gadgets */
  570.     LONG   StringHigh;
  571.     LONG   StringLow;
  572.  
  573.     struct Gadget * NextStringGadget; /* pointer to string Gadget
  574.                      to activate when a GadgetUp msg
  575.                      is recieved from this one */
  576.  
  577.     void (*GUpFunction) (struct IGRequest *,struct IntuiMessage *);
  578.     void (*GDownFunction) (struct IGRequest *,struct IntuiMessage *);
  579.     void (*DSelectFunction) (struct IGRequest *,struct IntuiMessage *);
  580.                    /* Same as GUpFunction but will always be called,
  581.                    either on GadgetUp, or when another gadget
  582.                    is activated, thereby deactivating this one */
  583.  
  584.     struct IGObject *IGObject; /* Object which this String Gadget is part of */
  585.     UBYTE *RexxName; /* Name that Arexx commands can refer to this gadget by */
  586.     APTR UserData;
  587. };
  588.  
  589.  
  590.  
  591. IGPropArrowInfo Structure
  592. This is defined in IntuiGen.h:
  593.  
  594. struct IGPropArrowInfo {
  595.     USHORT Type; /* must be GADG_ARROW */
  596.     struct Gadget *Prop; /* Pointer to prop Gadget with which this
  597.                 arrow is associated.  Need not be initialized,
  598.                 PropInfo will point to arrow Gadget which will
  599.                 Point here, so that the prop field can be initialized
  600.                 automatically by IGRequest */
  601.     void (*GUpFunction) (struct IGRequest *,struct IntuiMessage *);
  602.       /* function to call on GadgetUp */
  603.  
  604.     void (*GDownFunction) (struct IGRequest *,struct IntuiMessage *);
  605.       /* Function to call on GadgetDown */
  606.  
  607.     struct IGObject *IGObject; /* Object which this PropArrow is part of */
  608.     APTR UserData;
  609. };
  610.  
  611.  
  612.  
  613. IGPropInfo Structure
  614. This is defined in IntuiGen.h:
  615.  
  616. struct IGPropInfo {
  617.     USHORT Type; /* must be GADG_PROP */
  618.     void (*ScrollFunc) (struct IGRequest *,struct Gadget *,LONG,LONG);
  619.      /* called when arrows clicked, held down, or
  620.                   prop played with */
  621.      /*Args: ScrollFunc(IGRequest,gadget,XPos,YPos)*/
  622.  
  623.     struct SelectBox *SBox; /* Pointer to SelectBox with which this Prop
  624.                    Gadget associated */
  625.     struct Gadget *LUArrow; /* Pointer to the Left or Up arrow Gadget */
  626.     struct Gadget *RDArrow; /* Pointer to the Right or Down arrow Gadget */
  627.     USHORT MaxX; /* Number of Items to be displayed horizontally */
  628.     USHORT MaxY; /* Number of Items to be displayed vertically */
  629.     USHORT DisplayedX; /* Number displayed at one time */
  630.     USHORT DisplayedY;
  631.     USHORT Top; /* Topmost item currently being displayed */
  632.     USHORT Left; /* Leftmost item currently being displayed */
  633.     struct IGObject *IGObject; /* Object which this Scroll Bar is part of */
  634.     APTR UserData;
  635. };
  636.  
  637.  
  638.  
  639. IGObject Structure
  640. This is defined in IntuiGen.h:
  641.  
  642. /* struct IGObject */
  643. /* This is somewhat esoteric, but works as follows:
  644.     An Object could be anything the user thinks up, such as a FileRequester,
  645.     which should be part of a requester.  The InitFunction is called first.
  646.     It should allocate and initialize the constituent Gadgets, Borders, Images,
  647.     IntuiTexts, SelectBoxes, or other IGObjects (which must be placed at the
  648.     end of the list in order to be recognized), accompanying IGInfo structures,
  649.     and add them to the appropriate linked lists.  It should also tie in any
  650.     additional functions to be called upon certain events.  For General
  651.     message functions - the ones pointed to in the IGRequest structure
  652.     itself (for instance RAWKEY, InitFunction, or DISKREMOVED), a passthru
  653.     feature should be provided as follows:
  654.  
  655.     The address in the IGRequest structure should be saved in the
  656.         structure pointed to by IGObject.Address
  657.     The address of the new function should be put in
  658.     When the new function is called, it should service the last object
  659.         of the appropriate type whose service flag is not set.  It should
  660.         immediately set the serviced flag in that object.
  661.         It should then perform whatever processing is necessary for
  662.         that object.  Last, it should that objects passthru function.
  663.  
  664.     The address should be saved in the structure pointed to by
  665.     IGObject address and not in a static variable so that the
  666.     function is fully reenterant and can be multitasked, and nested calls
  667.     (from nested IGRequests) can be made to it.  The serviced flag is to
  668.     allow multiple objects of complex types to exist in the same requester.
  669.  
  670.     Later, in the CleanUp Routine, each object should replace the original
  671.     value of each of these general functions that it used into the IGRequest
  672.     struct.  Since these objects are handled in reverse order, that will
  673.     restore the IGRequest structure to its previous state PROVIDING
  674.     that the only time the values of the General functions are changed
  675.     are in the InitFunctions and the cleanup.  NO OTHER ROUTINES MAY CHANGE
  676.     THESE FUNCTIONS DURING THE EXECUTION OF IGREQUEST IF IGOBJECTS ARE TO
  677.     BE USED.
  678.  
  679.     REMEMBER:  If an Object adds anything to one of the linked lists, and
  680.     then frees it upon exit from the requester, it also must remove its
  681.     reference from the linked list.  Failure to do so will cause a Guru.
  682.  
  683. */
  684.  
  685. struct IGObject {
  686.     BOOL (*InitFunction) (struct IGRequest *,struct IGObject *);
  687.                  /* The InitFunction should return 1 on error */
  688.  
  689. /*  The following two can be the same, but should be provided if the
  690.     InitFunction Allocates anything, providing a means to free it.
  691.     Any thing allocated on the IGRequest structure's key will be taken care
  692.     of, DO NOT FREE IT IN THESE FUNCTIONS!
  693.  
  694.     Arguments for both (so they are interchangeable, if desired):
  695.     Function (IGRequest,IGObject,EndListItem);
  696.  
  697.     ALL FUNCTIONS ARE PASSED POINTERS ONLY
  698. */
  699.     void (*AbortFunction) (struct IGRequest *,struct IGObject *,struct IGEndList *);
  700.     void (*RequestEndedFunction) (struct IGRequest *,struct IGObject *,struct IGEndList *);
  701.  
  702. /* The Rexx Function is sent rexx messages for this object.  It is up to
  703.    it to process them.    The Arexx command line would look like this:
  704.     RexxName Command Arg1 Arg2...Argn
  705.     Where RexxName is this objects name as defined below, and the command
  706.     and arguments are specific to this object.
  707.  
  708.     This function should return True if it processed the Rexx Message,
  709.     and False if the Rexx Message needs further processing.
  710. */
  711.  
  712.     BOOL (*RexxFunction) (struct IGRequest *,struct IGObject *,struct RexxMsg *);
  713.  
  714.     UBYTE *Class; /* Label for this Object Class */
  715.     APTR Address; /* Pointer to data structure for this Object */
  716.     BOOL Serviced;
  717.     USHORT GadgetYOffSet; /* Number of pixels to add to TopEdge of Gadgets to
  718.                   compensate for larger system fonts used in title bars.
  719.                   If this is zero, the default system font is equivalent
  720.                   in vertical size to Topaz 8 (first usable row in Windows
  721.                   has Y coord of 11
  722.               */
  723.     struct IGObject *IGObject; /* Object which this Object is part of */
  724.     struct IGObject *Next;
  725.     struct IGObject *Prev; /* Need not be initialized, IGRequest will fix */
  726.     UBYTE *RexxName; /* Name for this Object to be addressed by via Rexx Programs */
  727.     APTR UserData;
  728. };
  729.  
  730.  
  731.  
  732. IGFileRequest Structure
  733. This is defined in IntuiGen.h:
  734.  
  735. /* This is an IGObject.  Code for this object is in the file IGFR.c in
  736.    the source directory.  An example is in the examples directory
  737.    under FileRequest.c.  To use this, first fill out an IGFileRequest
  738.    stucture.  Next Fill out an IGObject structure.  The InitFunction
  739.    should be MakeIGFileRequest.  The Address field should point to the
  740.    IGFileRequest structure.  All can be left blank.
  741. */
  742. struct IGFileRequest {
  743.     USHORT LeftEdge,TopEdge; /* LeftEdge, TopEdge of FileRequester */
  744.     UBYTE  FileName[200]; /* Current directory is taken from this */
  745.               /* Upon exit, chosen file and path name is
  746.               /* stored here */
  747.     UBYTE  Extension[10]; /* File extension, only files with this extension
  748.                * will be placed in Requester */
  749.     UBYTE  BColor1,BColor2; /* Border Colors for SBox border and FileRequest
  750.                  * Border */
  751.     USHORT  Flags;    /* IGFR_OKCANCEL       Put Ok and Cancel Gadgets
  752.                        in requester
  753.             IGFR_CURRENTDIR   Initialize requester to
  754.                        current directory
  755.             IGFR_NOINFO      Do not display info files
  756.             IGFR_MULTISELECT  Have ToggleSelect FileRequester
  757.                        Selected Entries can be read
  758.                        by cycling through IGDirEntry
  759.                        list pointed to by First.
  760.                        In MultiSelect requesters, this
  761.                        list is not freed upon termination
  762.                        of the request (so that it can be
  763.                        examined later).  To free it,
  764.                        FreeRemember the DirKey.
  765.                        When this option is on, a single
  766.                        click selects a directory, a
  767.                        double click opens it.
  768.             IGFR_VARSSAVED       This causes the Selectbox
  769.                            to be completely cleared
  770.                            and the display rebuilt
  771.                            from DirEntries present
  772.                            upon initialization.
  773.                            This can be used when
  774.                            Manually saving variables,
  775.                            including the DirEntry list,
  776.                            Closing the request, and
  777.                            then reopening it with a
  778.                            a directory already read.
  779.             IGFR_NOFILESELECT  Causes File names to be ghosted,
  780.                         not selectable
  781.              */
  782.  
  783.     /* These should all be initialized to zero */
  784.  
  785.     BYTE   CLBit;        /* req->CallLoop bit allocated */
  786.     BPTR   Lock;        /* For reading directory */
  787.     struct FileInfoBlock *FInfo; /* For reading directory */
  788.     struct SelectBox *SBox;     /* SelectBox (allocated) */
  789.     struct Gadget *Gadgets;     /* Gadgets (allocated */
  790.     struct Border *Borders;     /* Borders (allocated */
  791.     struct Remember *Key;     /* Key upon which above is allocated
  792.                     automatically freed on exit */
  793.     struct Remember *DirKey;     /* Key upon which current directory entries
  794.                     are allocated, automatically freed */
  795.     struct IGDirEntry *First;       /* Pointer to first DirEntry in linked list */
  796.     USHORT Number;         /* Number of entries in DirEntry list */
  797.     void (*LoopFunction) ();     /* Variable in which IGRequest's LoopFunction
  798.                   * is saved */
  799.     void (*DRemoved) ();         /* Variable DiskRemoved saved to */
  800.     void (*DInserted) ();        /* Variable DiskInserted saved to */
  801.     struct IGDirEntry *DCEntry;  /* Last Entry Selected (for double click */
  802.     ULONG DCSecs,DCMics;     /* Double click time, seconds */
  803.  
  804.     /* These can be used by you or other objects */
  805.  
  806.     struct IGObject *Object;     /* Pointer to IGObject of which this is part
  807.                   * DOES NOT POINT BACK TO THIS REQUESTER'S
  808.                   * IGOBJECT STRUCTURE.  This permits
  809.                   * a file requester to be part of another
  810.                   * IGObject */
  811.     APTR UserData;         /* UserData */
  812. };
  813.  
  814.  
  815.  
  816. IGDirEntry Structure
  817. This is defined in IntuiGen.h:
  818.  
  819. /* These are the structure and flag definitions for the linked list pointed
  820.    to by the First field in the IGFileRequest structure.  The current
  821.    directory is stored thus.
  822. */
  823. #define IGDE_DIR 1       /* This entry is directory */
  824. #define IGDE_DISPLAYED 2   /* This entry matches current file matching specs */
  825. #define IGDE_SELECTED 4    /* This entry is selected (in MULTISELECT
  826.                   FileRequester's only */
  827.  
  828. #define IGDE_FILESONLY 8       /* These are for use with the DupDirList function */
  829. #define IGDE_NOTDISPLAYED 16   /* only.  They are not written into the */
  830. #define IGDE_NOTSELECTED 32    /* IGDirEntry structure.  */
  831. #define IGDE_ALL 0
  832. #define IGDE_DIRSONLY 1
  833.  
  834. struct IGDirEntry {
  835.     UBYTE *FileName;
  836.     UBYTE Flags;
  837.     struct SelectBoxEntry *SBE;
  838.     struct IGDirEntry *Next,*Prev;
  839. };
  840.  
  841.  
  842.  
  843. IGEndList Structure
  844. This is defined in IntuiGen.h:
  845.  
  846. struct IGEndList {
  847.     ULONG Class; /* IDCMP class of message to end requester */
  848.     USHORT Code; /* IDCMP code of message to end requester */
  849.     USHORT Qualifier; /* IDCMP qualifier of message to end requester */
  850.     struct Gadget *Gadget; /* if Gadget msg, address of gadget to end requester */
  851.  
  852.     BOOL (*OKToEnd) (struct IGRequest *,struct IntuiMessage *);
  853.      /* 1=end request, 0=don't end request */
  854.     void (*Function) (struct IGRequest *,struct IntuiMessage *);
  855.      /* Function to call if this ending is taken */
  856.  
  857.     BOOL FillStruct; /* Fill DataStructure if this ending is taken? */
  858. };
  859.  
  860.  
  861.  
  862. IGKeyCommand Structure
  863. This is defined in IntuiGen.h:
  864.  
  865. struct IGKeyCommand {
  866.     USHORT Command; /* RAWKEY code*/
  867.     USHORT ASCIICommand; /* ASCII code for unqualified key.  Fill in either
  868.     this or Command.  If this is filled in, the equivalent Rawkey is
  869.     looked up from the current keymap and placed in Command by IGRequest.
  870.     If both ASCIICommand and Command are 0, RawKey code of 0 is assumed.
  871.     */
  872.     USHORT Qualifier; /* Qualifier */
  873.     struct Gadget *Gadget; /*pointer to gadget that code/qualifier
  874.                  will activate */
  875. };
  876.  
  877.  
  878.  
  879. IGMenu Structure
  880. This is defined in IntuiGen.h:
  881.  
  882. struct IGMenu {
  883.     USHORT Code; /* Number that will be recieved in Code field of
  884.             IntuiMessage when this MenuItem Chosen */
  885.     void (*Function) (struct IGRequest *,struct IntuiMessage *);
  886.     /* Function to call when MenuItem Chosen */
  887.     UBYTE *RexxName;
  888. };
  889.  
  890.  
  891.  
  892. MessageHandler Structure
  893. This is defined in IntuiGen.h:
  894.  
  895. /*  Use this to set up handling routines for classes of messages or
  896.     sequences of messages not supported by IGRequest.  (Shift Click,
  897.     Triple Click, etc.)
  898. */
  899. struct MessageHandler {
  900.     UBYTE *Name; /* Name of this class.  Can be whatever you want */
  901.     BOOL (*IsType) (struct IGRequest *,struct IntuiMessage *);
  902.     /* Called on every message.  Should return 1 if the message
  903.         constitutes the correct type, 0 otherwise */
  904.     void (*HandlerFunction) (struct IGRequest *,struct IntuiMessage *);
  905.     /* If IsType () returns 1, this is called */
  906.     struct MessageHandler *Next;
  907. };
  908.  
  909.  
  910.  
  911. IGRequest Structure
  912. This is defined in IntuiGen.h:
  913.  
  914. struct IGRequest {
  915.     struct NewWindow *NewWindow; /* pointer to NewWindow to open */
  916.                  /* pointer to opend window will be
  917.                     placed in IGRequest->Window field */
  918.     struct Window *Window; /* pointer to already opened window
  919.                   IGRequest will not close window unless it
  920.                   opened it */
  921.     UBYTE *ScreenName;    /* ScreenName to use with this window */
  922.     struct Requester *RequesterToOpen; /* pointer to Intuition Requester
  923.                       to open */
  924.     struct Requester *Requester; /* Pointer to already open Intuition Requester */
  925.     struct IGMenu *Menus; /* pointer to null terminated array of IGMenu structures
  926.                  for handling of menus */
  927.     struct IGEndList *EndList; /* pointer to null terminated array of IGEndList
  928.                   structures */
  929.     struct IGKeyCommand *KeyCommands; /* pointer to null terminated array of
  930.                      IGKeyCommand structures */
  931.     struct Gadget *Gadgets; /* pointer to first gadget in requester to use */
  932.     USHORT Flags; /* Possible Values:
  933.         IG_INITREQUESTERTOOPEN     Causes RequesterToOpen to be
  934.                      Initialized before opening
  935.         IG_ADDGADGETS         Causes Gadgets to be Added to Window
  936.                      or requester
  937.         IG_INITDATASTRUCT     Causes Data Struct to be Initialized
  938.                      to default values for string and
  939.                      Toggleselect flag fields,
  940.                      useful with newly allocated
  941.                      Data Structures
  942.     */
  943.     struct Gadget *StringToActivate; /* Pointer to string Gadget to activate when
  944.                     requester first opened */
  945.     struct Menu *MenuStrip;         /* pointer to menu list to add to window
  946.                     when opened */
  947.     struct Border *Borders;  /* pointer to Border list to draw into window */
  948.     struct Image *Images;    /* pointer to Image list to draw into window */
  949.     struct IntuiText *ITexts; /* pointer to IntuiText list to write into window */
  950.     struct SelectBox *SBoxes;  /* pointer to first SelectBox to put into this window */
  951.     struct IGObject *IGObjects; /* pointer to first IGObject structure */
  952.     APTR DataStruct;         /* pointer to structure to fill */
  953.     struct Remember *ReqKey; /* Strings without buffers allocated on this */
  954.  
  955.     void (*InitFunction) (struct IGRequest *); /* function to call when requester first opened */
  956.  
  957.     BYTE Terminate; /* Can be set by outside routines to */
  958.          /* force request to end, >0==FillStruct, <0==!FillStruct */
  959.  
  960.     struct MsgPort *IComPort; /* Internal use only.  Initialize to 0 */
  961.     APTR InternalData;          /* Internal use only.  Initialize to 0 */
  962.  
  963.     void (*DSelectFunction) (struct IGRequest *,struct IntuiMessage *);
  964.      /* To be called any time String Gadget is
  965.       * De-Selected */
  966.  
  967.     void (*EndFunction) (struct IGRequest *,struct IntuiMessage *);
  968.      /* To be called when requester ends.
  969.       * This is called after any EndList EndFunction */
  970.  
  971.     void (*LoopFunction) (struct IGRequest *);
  972.                  /* This function is called repeatedly
  973.                   * while there is not a message at the
  974.                   * Window port and while CallLoop!=0
  975.                  */
  976.  
  977.     /* When using IGObjects, LoopFunction should be passed through.
  978.        If any of the Functions or Objects in the list need to be
  979.        called, the whole list must be called.  Each function then, should
  980.        perform the obligatory task of finding its corresponding object (the
  981.        last one of its type in the IGObject list that does not have its
  982.        serviced flag set) and set the serviced flag so that the function
  983.        that does need to be called can find its object.  After setting
  984.        the serviced flag, each function can then check some internal
  985.        variable, or CallLoop to see if it needs to do anything further.
  986.        It then must call whatever function it replaced from the IGRequest
  987.        structure.  To insure that one function does not clear CallLoop
  988.        when another function needs it set, each function should call
  989.        AllocCLBit to be assigned a bit in the CallLoop variable.  This
  990.        function should only change this bit.  LoopBitsUsed records
  991.        what bits are free and which ones have been allocated */
  992.  
  993.     ULONG CallLoop;
  994.     ULONG LoopBitsUsed;
  995.  
  996.     struct MsgPort *ArexxPort;
  997.     void (*ArexxFunction) (struct IGRequest *,struct RexxMsg *);
  998.     /*  Port to which Arexx messages are coming in.  IGRequest will
  999.         process and reply to the following commands:
  1000.         KEYCLICK qualifiers key
  1001.         GADGETCLICK gadgetname
  1002.         SETSTRINGGAD stringgad string
  1003.  
  1004.         If IGRequest can't find the specified gadget, or encounters an
  1005.         unrecognized commands, the RexxMsg will be passed to your
  1006.         ArexxFunction to process.  If an ArexxFunction
  1007.         is not specified, an error will be set. IGRequest replies to all
  1008.         RexxMsgs.
  1009.     */
  1010.  
  1011.     ULONG AdditionalSignals; /* Additional signals to Wait on */
  1012.     BOOL  (*SignalFunction) (struct IGRequest *,ULONG);
  1013.  
  1014.     /* Called before IGRequest goes into wait state.  Use this to test
  1015.         Ports that you are waiting on through AdditionalSignals for messages.
  1016.         Process one message at a time.  Return 0 if IGRequest can go
  1017.         into a wait state, 1 if you require further processing time,
  1018.         in which case your function will be called again (after checking
  1019.         the window port, calling the loopfunction, etc.)
  1020.  
  1021.  
  1022.          SignalFunction (IGRequest,Signals);
  1023.     */
  1024.  
  1025.  
  1026.     /* The Following correspond with IDCMP messages, and are called when that
  1027.      *    message is recieved
  1028.     */
  1029.  
  1030.     void (*GUpFunction)         (struct IGRequest *,struct IntuiMessage *);
  1031.     void (*GDownFunction)       (struct IGRequest *,struct IntuiMessage *);
  1032.     void (*MouseButtons)        (struct IGRequest *,struct IntuiMessage *);
  1033.     void (*MouseMove)           (struct IGRequest *,struct IntuiMessage *);
  1034.     void (*DeltaMove)           (struct IGRequest *,struct IntuiMessage *);
  1035.     void (*RawKey)              (struct IGRequest *,struct IntuiMessage *);
  1036.     void (*IntuiTicks)          (struct IGRequest *,struct IntuiMessage *);
  1037.     void (*DiskInserted)        (struct IGRequest *,struct IntuiMessage *);
  1038.     void (*DiskRemoved)         (struct IGRequest *,struct IntuiMessage *);
  1039.     void (*MenuVerify)          (struct IGRequest *,struct IntuiMessage *);
  1040.     void (*MenuPick)            (struct IGRequest *,struct IntuiMessage *);
  1041.     void (*SizeVerify)          (struct IGRequest *,struct IntuiMessage *);
  1042.     void (*NewSize)             (struct IGRequest *,struct IntuiMessage *);
  1043.     void (*ReqVerify)           (struct IGRequest *,struct IntuiMessage *);
  1044.     void (*ReqSet)              (struct IGRequest *,struct IntuiMessage *);
  1045.     void (*ReqClear)            (struct IGRequest *,struct IntuiMessage *);
  1046.     void (*ActiveWindow)        (struct IGRequest *,struct IntuiMessage *);
  1047.     void (*InActiveWindow)      (struct IGRequest *,struct IntuiMessage *);
  1048.     void (*RefreshWindow)       (struct IGRequest *,struct IntuiMessage *);
  1049.     void (*NewPrefs)            (struct IGRequest *,struct IntuiMessage *);
  1050.     void (*CloseWindow)         (struct IGRequest *,struct IntuiMessage *);
  1051.     void (*DoubleClick)         (struct IGRequest *,struct IntuiMessage *);
  1052.  
  1053.     struct MessageHandler *OtherMessages;
  1054.     APTR UserData;
  1055. };
  1056.  
  1057.  
  1058.  
  1059. cismember Function
  1060. /* returns TRUE is character c is in string s, other wise returns false */
  1061.  
  1062. int cismember (char c,char *set);
  1063.  
  1064.  
  1065.  
  1066. delchars Function
  1067. /* deletes n chars starting at position p from string s */
  1068.  
  1069. void delchars (char *s,USHORT p,USHORT n);
  1070.  
  1071.  
  1072.  
  1073. strelim Function
  1074. /* if k==FALSE deletes every occurance of any character in string elim in
  1075. *        string s
  1076. *  if k==TRUE  deletes every occurance of any character not in string elim in
  1077. *        string s
  1078. *  returns true if any characters were deleted */
  1079.  
  1080. BOOL strelim (char *s,char *elim,BOOL k);
  1081.  
  1082.  
  1083.  
  1084. PullWord Function/Macros
  1085. /* Convenient routine to pull words off of a string.  Multiple words in
  1086. *  quotes as single words.  Keeps track of nested Quotes ('"Nested quotes"').
  1087. *  slist is the string to pull words off of.  word is the buffer to copy
  1088. *  the word to.  index is the index to start at in slist.  delim is a string
  1089. *  that contains characters that should be ignored, but counted as delimiters.
  1090. *  retdelim contains characters that should be used as delimiters and returned
  1091. *  as words by themselves.  len is the length of word.
  1092. */
  1093.  
  1094. #define RxPullWord(rxcom,combuf,ndx,len) \
  1095.     PullWordIndex(rxcom,combuf,ndx," ,","",len)
  1096.  
  1097. LONG PullWordIndex (UBYTE *slist,UBYTE *word,USHORT index,
  1098.               UBYTE *delim,UBYTE *retdelim,USHORT len);
  1099.  
  1100.  
  1101.  
  1102. RawKeyToAscii Function
  1103. /* Takes RAWKEY code and qualifier (from an IntuiMessage) and returns
  1104. *  ASCII equivalent
  1105. */
  1106.  
  1107. UBYTE RawKeyToAscii (USHORT code,USHORT qual);
  1108.  
  1109.  
  1110.  
  1111. ClearWindow Function
  1112. /*
  1113. *  ClearWindow Function, clears inside of window to background (0)
  1114. */
  1115.  
  1116. void ClearWindow (struct Window *w);
  1117.  
  1118.  
  1119.  
  1120. ModifyIGProp Function
  1121. /* Refreshes values in IGInfo, PropInfo structures for IG Prop Gadget */
  1122. /* You MUST use this instead of Intuition's ModifyProp */
  1123.  
  1124. void ModifyIGProp (struct IGRequest *req, /* IGRequest containing prop gadget */
  1125.            struct Gadget *prop, /* Prop Gadget */
  1126.            USHORT mx,my,dx,dy, /* MaxX, MaxY, DisplayedX, DisplayedY, */
  1127.            USHORT top,left); /* Top position, Left Position */
  1128.  
  1129.  
  1130.  
  1131. SendIntuiMsg Function
  1132. /* Sends an IntuiMessage to an IGRequest over an internal port (not the
  1133. *   window port).  IGRequest treats messages coming to this port as if they
  1134. *   had came directly to the window port.
  1135. *   NOTE:  These messages should be freed using the macro FreeIntuiMsg().
  1136. *        They are not intended to be replied to.
  1137. */
  1138.  
  1139. BOOL SendIntuiMsg (struct IGRequest *req,ULONG Class,ULONG Code,
  1140.             USHORT Qualifier,APTR IAddress);
  1141.  
  1142. /* Frees an IntuiMessage allocated by SendIntuiMsg.  Use this instead of
  1143. *  ReplyMsg.
  1144. */
  1145.  
  1146. #define FreeIntuiMsg(x) FreeMem(x,sizeof(struct IntuiMessage))
  1147.  
  1148.  
  1149.  
  1150. StimulateGadget Function
  1151. /* Causes a Gadget to look like it was clicked by the user
  1152. *     Activates string gadgets
  1153. *     Selects or deselects toggle gadgets
  1154. *     Causes select and then deselect for Bool Gadgets
  1155. *  DOES NOT SEND ANY MESSAGES OR EFFECT BEHAVIOR OF PROGRAM - SIMPLY
  1156. *  CHANGES GADGET APPEARANCE
  1157. */
  1158.  
  1159. void StimulateGadget (struct IGRequest *req,struct Gadget *gadg);
  1160.  
  1161.  
  1162.  
  1163. GadgetClick Function
  1164. /* Causes the program to behave as if they user clicked on a
  1165. *  Gadget.  Sends appropriate messages to IGRequest, causes gadget
  1166. *  to be stimulated.
  1167. */
  1168.  
  1169. BOOL GadgetClick(struct IGRequest *req,struct Gadget *gadg);
  1170.  
  1171.  
  1172.  
  1173. KeyClick Function
  1174. /* Sends a RAWKEY message to an IGRequest.  keyinfo points to a string
  1175. *  that can contain any of the following letters in any order:
  1176. *     s - shift
  1177. *     c - control
  1178. *     a - alt
  1179. *     A - command (Amiga)
  1180. *  Letters besides these will be ignored.  Case is significant.
  1181. *  key contains the ASCII code of the key to send.  It is converted
  1182. *  to Rawkey using the current default keymap.
  1183. */
  1184.  
  1185. BOOL KeyClick (struct IGRequest *req,UBYTE *keyinfo,UBYTE key);
  1186.  
  1187.  
  1188.  
  1189. MenuPick Function
  1190. /* This function will cause the program to behave as if the user
  1191.    had selected the given menu item manually.
  1192. */
  1193.  
  1194. BOOL MenuPick (struct IGRequest *req,struct IGMenu *igm);
  1195.  
  1196.  
  1197.  
  1198. SetStringGad Function
  1199. /* Copies string to a string Gadget buffer, refreshes string gadget,
  1200. *  and sends GADGETUP and GADGETDOWN messages to IGRequest.
  1201. */
  1202.  
  1203. void SetStringGad (struct IGRequest *req,struct Gadget *gadg,UBYTE *string);
  1204.  
  1205.  
  1206.  
  1207. BlockIGInput Function
  1208. /*
  1209.     BlockIGInput Function opens an blank intuition requester on top
  1210.     of an IGRequest, thereby blocking its input
  1211. */
  1212. void BlockIGInput(struct IGRequest *req);
  1213.  
  1214.  
  1215.  
  1216. UnBlockIGInput Function
  1217. /*
  1218.     UnBlockIGInput closes blank requester opened by BlockIGInput, thereby
  1219.     permitting messages to come through again
  1220. */
  1221. void UnBlockIGInput(struct IGRequest *req);
  1222.  
  1223.  
  1224.  
  1225. BoolRequest Function
  1226. /* Opens an Intuition requester over IGRequest req, with message string, and
  1227.    2 Gadgets, labeled by strings g1 and g2.  returns 0 if g1 is selected,
  1228.    1 if g2 is selected
  1229. */
  1230.  
  1231. BOOL BoolRequest (struct IGRequest *req,UBYTE *string,UBYTE *g1,UBYTE *g2);
  1232.  
  1233.  
  1234.  
  1235. IGRequest Function
  1236. /* Handles all necessary procedures to display and handle IGRequest req
  1237.    returns pointer to endlist item that caused request to terminate,
  1238.    if termination was caused by Terminate field in req being set to TRUE,
  1239.    returns pointer to allocated (on req->ReqKey) endlist struct with class
  1240.    of IG_REQTERMINATE, returns NULL on error */
  1241.  
  1242. #ifdef IGFAR /* define this in your source for far IGRequest */
  1243.          /* Be careful if you use precompiled headers!!! */
  1244. __far
  1245. #endif /* IGFAR */
  1246.  
  1247. struct IGEndList *IGRequest (struct IGRequest *req);
  1248.  
  1249.  
  1250.  
  1251. IGRemove Functions
  1252. /* For removing a Gadget from the IGRequest's Gadget list that was
  1253. *  added by an IGObject.  This will normally be called by that
  1254. *  object's cleanup routine.  IT CANNOT BE CALLED WHILE THE REQUESTER
  1255. *  IS ACTIVE (ON SCREEN).
  1256. *
  1257. *  The Following IGRemove functions perform similar functions, just
  1258. *  on a different structure category.
  1259. */
  1260.  
  1261. void IGRemoveGadget (struct IGRequest *req,struct Gadget *rm);
  1262. void IGRemoveImage (struct IGRequest *req,struct Image *rm);
  1263. void IGRemoveBorder (struct IGRequest *req,struct Border *rm);
  1264. void IGRemoveIText (struct IGRequest *req,struct IntuiText *rm);
  1265. void IGRemoveSBox (struct IGRequest *req,struct SelectBox *rm);
  1266. void IGRemoveIGObject (struct IGRequest *req,struct IGObject *rm);
  1267.  
  1268.  
  1269.  
  1270. AllocCLBit Function
  1271. /* Allocates CallLoop bit for IGRequest CallLoops */
  1272.  
  1273. BYTE AllocCLBit (struct IGRequest *req);
  1274.  
  1275.  
  1276.  
  1277. FreeCLBit Function
  1278. /* Frees CallLoop bit for IGRequest CallLoops */
  1279.  
  1280. void FreeCLBit (struct IGRequest *req,UBYTE bit);
  1281.  
  1282.  
  1283.  
  1284. FindRexxGadget Function
  1285. /* This routine finds a Gadget with a RexxName of name in a gadget list
  1286. *  pointed to by gadg. Used internally by IGRequest, but can also be used
  1287. *  by you.  Returns null on failure.
  1288. */
  1289.  
  1290. struct Gadget *FindRexxGadget (struct Gadget *gadg,UBYTE *name);
  1291.  
  1292.  
  1293.  
  1294. IGInitRequester Function
  1295. /* zeros values in Requester req, sets LeftEdge, TopEdge, Width, Height
  1296. *  values so that they are offsets from the edges of the window win */
  1297.  
  1298. void IGInitRequester (struct Window *win,    /* Window values relative to */
  1299.               struct Requester *req, /* Intuition Requester */
  1300.               SHORT rl, SHORT rr,    /* Left, right offsets from
  1301.                           * Window edge */
  1302.               SHORT rt,SHORT rb);    /* Top, Bottom offsets from
  1303.                           * Window edge */
  1304. /*  NOTE: This routine calls Intuition's InitRequest, clearing any
  1305. *   data values previously in requester */
  1306.  
  1307.  
  1308.  
  1309. FindRexxMenu Function
  1310. /* This routine finds a menu or submenu item with the RexxName of
  1311.    name in the requester described by the req IGRequest structure.
  1312.    It then returns a pointer to the IGMenu structure concerning it.
  1313.    This is used by the ARexx processing routines.
  1314. */
  1315.  
  1316. struct IGMenu *FindRexxMenu (struct IGRequest *req,UBYTE *name);
  1317.  
  1318.  
  1319.  
  1320. IGProcessRexxMsg Function
  1321. /* Processes a RexxMsg for IGRequest req.  Called internally by IGRequest
  1322. *  to implement the following Rexx commands:
  1323. *
  1324. *    GadgetClick <RexxGadgetName>
  1325. *    SetStringGad <RexxGadgetName> <String>
  1326. *    KeyClick <qualifiers> <key>
  1327. *    MenuPick <RexxMenuName>
  1328. *
  1329. *  Qualifers for KeyClick is a string like that sent to KeyClick above and
  1330. *  key should be the unqualified (non-shifted,controled,etc.) letter that
  1331. *  appears when the desired key is typed.
  1332. *
  1333. *  If IGProcessRexxMsg doesn't understand the command, or can't find
  1334. *  the specified Gadget in this IGRequest, it returns 1.  Otherwise it
  1335. *  returns 0.
  1336. *
  1337. *  If this routine returns 1 when called from IGRequest, IGRequest will call
  1338. *  your ArexxFunction.    If you don't have an ArexxFunction, it will set
  1339. *  the Result1 field to 10 before replying to the message.
  1340. */
  1341.  
  1342. BOOL IGProcessRexxMsg (struct IGRequest *req,struct RexxMsg *rm);
  1343.  
  1344.  
  1345.  
  1346. UpDateSBox Function
  1347. /* Scroll Function in SBox's Prop's IGInfo should point to here */
  1348. /* The user doesn't have to worry about this, IGRequest takes care of it */
  1349. void UpdateSBox (struct IGRequest *req, struct Gadget *gadg,
  1350.          LONG x,LONG y);
  1351.  
  1352.  
  1353.  
  1354. RefreshSBox Function
  1355. /* Call this after you have added entries */
  1356. /* It redraws the SelectBox */
  1357.  
  1358. void RefreshSBox (struct IGRequest *req,struct SelectBox *sb);
  1359.  
  1360.  
  1361.  
  1362. FixIDs Function
  1363. /*  Renumbers ID's in entries so that they are correct
  1364. NOTE:  A SELECT BOX WILL NOT WORK IF ITS IDS ARE NOT CONSECUTIVE
  1365.        STARTING AT 0 */
  1366. void FixIDs (struct SelectBoxEntry *first);
  1367.  
  1368.  
  1369.  
  1370. MakeBox Function
  1371. /* Allocates two border structures and SHORT values on the key, and creates
  1372.    Box, returns pointer to first Border structure */
  1373. struct Border *MakeBox (USHORT w,  USHORT h,
  1374.             UBYTE c1, UBYTE c2,
  1375.             struct Remember **key);
  1376.  
  1377.  
  1378.  
  1379. MakeSBEntryList Function
  1380. /* using array of strings items, with num strings, it allocates SelectBoxEntry
  1381.     structures for each item and creates a entries list that can be
  1382.     used with a selectbox.    Just set the SBox's Entries field to this
  1383.     functions return value.  All allocations are make on the key */
  1384. struct SelectBoxEntry *MakeSBEntryList (struct Remember **key,
  1385.                     char *items[],int num,
  1386.                     void (*func) ());
  1387.  
  1388.  
  1389.  
  1390. FixLinks Function
  1391. /* Goes through a list of SelectBoxEntries linked only by the Next field,
  1392.    and make the list doubly linked (both Next and Prev fields valid */
  1393. void FixLinks (struct SelectBoxEntry *first);
  1394.  
  1395.  
  1396.  
  1397. AddSBEntry Function
  1398. /* Adds a SelectBoxEntry toadd to the list currently being used by SelectBox
  1399.     sb.  toadd is added at position pos, if pos==-1, it is added at the end */
  1400. void AddSBEntry (struct SelectBox *sb,struct SelectBoxEntry *toadd,int pos);
  1401.  
  1402.  
  1403.  
  1404. AddEntry Function
  1405. /* allocates a SelectBoxEntry on key, and sets its Text field to point to
  1406.     string entry, and its ItemSelected field to point to func, then adds
  1407.     the new entry to SelectBox sb at position pos */
  1408. BOOL AddEntry (struct SelectBox *sb,
  1409.            char *entry, void (*func) (),
  1410.            int pos);
  1411.  
  1412.  
  1413.  
  1414. AddEntryAlpha Function
  1415. /*  Same as above, but inserts the entry into entry list in alphabetical
  1416.     order */
  1417. BOOL AddEntryAlpha (struct SelectBox *sb,
  1418.             char *entry, void (*func) () );
  1419.  
  1420.  
  1421.  
  1422. RemoveSBEntry Function
  1423. /* Removes entry from SelectBoxes SelectBoxEntry List.    Does not
  1424.  * free entry (which is necessary with entries added via AddEntry
  1425.  * and AddEntryAlpha). */
  1426. void RemoveSBEntry (struct SelectBox *sb,struct SelectBoxEntry *e);
  1427.  
  1428.  
  1429.  
  1430. FreeSBEntry Function
  1431. /* Frees SelectBoxEntry allocated with AllocMem, AddEntry, or
  1432.  * AddEntryAlpha */
  1433. void FreeSBEntry (struct SelectBoxEntry *e);
  1434.  
  1435.  
  1436.  
  1437. ClearSBox Function
  1438. This Function removes all a selectBox's entries
  1439.  
  1440.     void ClearSBox (struct SelectBox *sb,BOOL freeEntries);
  1441.  
  1442.  
  1443.  
  1444. SBoxSelect/DSelectAll Function
  1445. These functions select and deselect all of a SBox's entries respectively:
  1446.  
  1447.     void SBoxSelectAll (struct SelectBox *sb);
  1448.     void SBoxDSelectAll (struct SelectBox *sb);
  1449.  
  1450.  
  1451.  
  1452. MakeIGFileRequest Function
  1453. /* Set the InitFunction field of the IGObject structure to point
  1454.    to this function.  The Address field must contain a pointer to
  1455.    an initialized IGFileRequest structure */
  1456.  
  1457. MakeIGFileRequest (struct IGRequest *req,struct IGObject *obj);
  1458.  
  1459.  
  1460.  
  1461. ShowDir Function
  1462. /* If you change the name in FileName, call this routine to show
  1463.    the directory */
  1464.  
  1465. void ShowDir (struct IGRequest *,struct IGFileRequest *);
  1466.  
  1467.  
  1468.  
  1469. FixFile Function
  1470. /* This routine updates the FileName Gadget */
  1471.  
  1472. void FixFile (struct IGRequest *req,struct IGFileRequest *fr);
  1473.  
  1474.  
  1475.  
  1476. ChopLevel Function
  1477. /* This routine will change the string FileName so that it contains one
  1478.    less directory level, or contains the directory short the filename*/
  1479.  
  1480. void ChopLevel (UBYTE *FileName);
  1481.  
  1482.  
  1483.  
  1484. FixDirNameEnding Function
  1485. /* This routine insures that a directory name ends either with ':' or '/',
  1486.    and if necessary appends a '/' so that you can strcat filenames onto a
  1487.    directory name easily */
  1488.  
  1489. void FixDirNameEnding (UBYTE *dirname);
  1490.  
  1491.  
  1492.  
  1493. GetFileName Function
  1494. /* This routine will copy the last part (after the last '/' or ':') of
  1495.    pathfile to file */
  1496.  
  1497. void GetFileName (UBYTE *pathfile,UBYTE *file);
  1498.  
  1499.  
  1500.  
  1501. GetFRDirName Function
  1502. /* This routine will take a path and file name, and copy it file minus
  1503.    a filename if one is present.  Pathfile is assumed to have just come
  1504.    from fr (which has a flag bit set if a filename was present */
  1505.  
  1506. void GetFRDirName (UBYTE *pathfile,UBYTE *file, struct IGFileRequest *fr);
  1507.  
  1508.  
  1509.  
  1510. UpDirectory Function
  1511. /* This routine erases the last level from a file requester's
  1512.    filename and then calls FixFile */
  1513.  
  1514. void UpDirectory (struct IGRequest *req,struct IGFileRequest *fr);
  1515.  
  1516.  
  1517.  
  1518. SetDirectory Function
  1519. /* Sets given file requester to given directory */
  1520.  
  1521. void SetDirectory (struct IGRequest *,struct IGFileRequest *,UBYTE *dir);
  1522.  
  1523.  
  1524.  
  1525. SelectFile Function
  1526. /* Selects file in file requester, taking into account single select
  1527.    or multiselect modes.  If necessary, waits until directory has been
  1528.    read.
  1529. */
  1530.  
  1531. BOOL SelectFile (struct IGRequest *,struct IGFileRequest *,UBYTE *file);
  1532.  
  1533.  
  1534.  
  1535. SetPathFile Function
  1536. /* Selectively calls one or both of SetDirectory and SelectFile, depending
  1537.    on whether path is directory name of directory and file name or just
  1538.    file name.
  1539. */
  1540.  
  1541. BOOL SetPathFile (struct IGRequest *,struct IGFileRequest *,UBYTE *path);
  1542.  
  1543.  
  1544.  
  1545. DupDirList Function
  1546. /*  This function will duplicate a Directory Entry list, matching the
  1547.     criteria given in flags.  If there is any chance of an IGFR routine
  1548.     running while you are looking through the DirEntry list (like IGFR
  1549.     freeing the list), duplicate it first to avoid problems.  The following
  1550.     are flags you can use, in any combinations.
  1551.  
  1552.     IGDE_DISPLAYED     Entries must match current file matching specs
  1553.                   to be copied
  1554.     IGDE_SELECTED     Entries must be selected (in MULTISELECT
  1555.                   FileRequester's only
  1556.     IGDE_FILESONLY     Entries must be files
  1557.     IGDE_DIRSONLY     Entries must be directories
  1558.     IGDE_NOTDISPLAYED   Entries must not match current file matching
  1559.                   specs
  1560.     IGDE_NOTSELECTED    Entries must not be selected (in MULTISELECT
  1561.                   FileRequester's only
  1562.     IGDE_ALL        Both files and directories will be copied
  1563.  
  1564.     Note:  Do not write to the FileName field of duplicated IGDirEntry
  1565.          structures, or add entries to the linked list that were not
  1566.          created by the DupDirList function, as they will not be properly
  1567.          freed (read "The Computer will Guru")
  1568. */
  1569.  
  1570. struct IGDirEntry *DupDirList(struct IGFileRequest *fr,ULONG flags);
  1571.  
  1572.  
  1573.  
  1574. FreeDirList Function
  1575. /*   Use this function to free a linked list created by DupDirList */
  1576.  
  1577. void FreeDirList(struct IGDirEntry *de);
  1578.  
  1579.  
  1580.  
  1581. IGFRSelectAll Function
  1582. /* Selects all files in multiselect file requester */
  1583.  
  1584. void IGFRSelectAll (struct IGRequest *req, struct IGFileRequest *fr);
  1585.  
  1586.  
  1587.  
  1588. IGFRDeSelectAll Function
  1589. /* Deselects all files in multiselect file requester,
  1590.    Deselects selected file, if any, in single select file requester
  1591. */
  1592.  
  1593. void IGFRDeSelectAll (struct IGRequest *req, struct IGFileRequest *fr);
  1594.  
  1595.  
  1596.  
  1597.